What Makes Up the User Interface Toolbox The User Interface toolbox actually consists of four parts - that is, four separate BASIC source-code files - and an include file for each. The files are. * MENU.BAS, MENU.BI * WINDOW.BAS, WINDOW.BI * MOUSE.BAS, MOUSE.BI * GENERAL.BAS, GENERAL.BI In each case, the .BAS file contains the actual code for the procedures and the .BI file contains user-defined type definitions and procedure declarations used in the .BAS file. The following discussion briefly explains the contents of each part of the User Interface toolbox. Menus The MENU.BAS source-code file contains all the procedures that let you create custom menus in your programs. These procedures are dependent on the other parts of the User Interface toolbox (GENERAL.BAS and MOUSE.BAS). If you use the procedures in MENU.BAS, you must include GENERAL.BI, MOUSE.BI, and MENU.BI in your program so you have the proper declarations and definitions. In addition to procedure declarations, the header file MENU.BI contains definitions of several user-defined types that are used in global variables to store menu configuration information. A more detailed explanation of menus and their application is described in the MENU.BAS section below. Windows The WINDOW.BAS source-code file contains the procedures that let you create custom character-based windows in your programs. WINDOW.BAS is dependent on all the other parts of the User Interface toolbox; therefore, when you use the procedures in WINDOW.BAS, you must include GENERAL.BI, MOUSE.BI, MENU.BI, and WINDOW.BI so that all declarations and definitions on which WINDOW.BAS depends are available. The header file WINDOW.BI contains procedure declarations along with the definitions of user-defined types. These user-defined types are used to store information about the characteristics of windows, buttons, and edit fields. Mouse The MOUSE.BAS source-code file provides mouse support. The procedures in this code can be used by themselves if need be, but they were designed as an integral part of the User Interface toolbox. The routines specifically support the Microsoft Mouse. A Microsoft Mouse and driver are recommended. However, the procedures support any pointing device with a 100 percent Microsoft-Mouse-compatible driver. A Microsoft driver (MOUSE.COM) is shipped with BASIC. If you use the procedures in MOUSE.BAS, you must include GENERAL.BI and MOUSE.BI in your program so you will have the proper declarations and definitions. The header file MOUSE.BI includes procedure declarations for the MOUSE.BAS file. General The GENERAL.BAS source-code file contains a number of general purpose character-based routines that are used in both the MENU.BAS and WINDOW.BAS files. While these files can be used by themselves, they are intended to support the other procedures in the User Interface toolbox. If you use any of the procedures in GENERAL.BAS, you must include the header file, GENERAL.BI. The header file GENERAL.BI contains a user-defined type definition (RegType) that is used with the Interrupt routine to access DOS interrupt services for mouse support. This DOS interrupt also returns the shift state of special keys, and scrolls screen areas. GENERAL.BI contains a number of global constant definitions that apply throughout the User Interface toolbox. These definitions are described in the following table. Constant Value Comment FALSE 0 TRUE -1 MINROW 2 Minimum number of rows on screen MAXROW 25 Maximum number of rows on screen MINCOL 1 Minimum number of columns on screen MAXCOL 80 Maximum number of columns on screen MAXMENU 10 Maximum number of menus on menu bar MAXITEM 20 Maximum number of items on a menu MAXWINDOW 10 Maximum number of windows on screen MAXBUTTON 50 Maximum number of buttons on screen MAXEDITFIELD 20 Maximum number of edit fields on screen MAXHOTSPOT 20 Maximum number of active areas on screen Note ---- An active area is defined as any area that can be selected by the user, including all types of buttons and edit fields, and any of the special characters used to affect windows. How to Use the Toolbox in Your Programs You can incorporate the User Interface toolbox into your programs in three ways. The first is to simply include the source-code files you plan to use in your program. For each source-code file you include, be sure to also include the associated .BI file. Use the $INCLUDE metacommand to include external files in your program. The second way is to load each BASIC source-code file as a separate module and use a Quick library only for the assembly-language routines. You should use this method if you are planning to alter or expand the functionality of the User Interface toolbox. Create the Quick library you need with the following command. LINK -Q UIASM.OBJ QBX.LIB, UIASM.QLB,,QBXQLB.LIB; The final method - and most practical when creating stand-alone programs - is to create a Quick library that uses the procedures in the BASIC source-code files and the assembly-language files. This is somewhat more difficult, but is still quite easy. If you chose to have Quick libraries created when you first installed BASIC, you already have the Quick library you need. If you didn't, you'll have to make it yourself. To begin, be sure that you are in the QBX directory where all of the .LIB files that came with the program are located. Creating a complete Quick library involves several steps. First you'll have to create a Quick library that includes needed procedures that are already in the QBX libraries (QBX.QLB and QBX.LIB) plus the User Interface toolbox object file, UIASM.OBJ. You can do this at the system prompt with the following command. LINK -Q UIASM.OBJ QBX.LIB, UIASM.QLB,,QBXQLB.LIB; Next, create the parallel .LIB library using the same files you just used to make the Quick library. Use the following command. LIB UIASM.LIB+UIASM.OBJ+QBX.LIB; Once you've created the first two libraries, you can create the libraries that include not only the assembly-language routines, but the BASIC procedures as well. The easiest way is to do this from the QBX programming environment. Start QBX with the -L option and specify the Quick library that you just created, as follows. QBX -L UIASM.QLB Once you are in the QBX programming environment, use the File menu to load each of the individual files you want to include in your User Interface toolbox library. For example, if you want to use menus in your program, load GENERAL.BAS, MOUSE.BAS, and MENU.BAS. GENERAL.BAS and MOUSE.BAS are required because of dependencies that exist between the components of the User Interface toolbox. If you want windows, load GENERAL.BAS, MOUSE.BAS, MENU.BAS, and WINDOW.BAS. With all of the files loaded, choose Make Library from the Run menu. When prompted for a library name, use the name UITBEFR.QLB. Press Return and two libraries will be created for you. The first is the Quick library that you will use whenever you want to incorporate menus into your programs that run in QBX. The second is the parallel .LIB file that will allow you to create a stand-alone .EXE file from your BASIC program. If you change any of the BASIC code that comprises the User Interface toolbox, you can relink those object modules and create new libraries and Quick libraries as needed. More complete information about creating libraries and using mixed-language programming can be found in Chapter 18, "Using LINK and LIB" in the Programmer's Guide. If you use a library or Quick library that contains procedures from one or more of the User Interface toolbox source-code files, you must include the .BI file for that source-code file into your program before you call any of the library's procedures. If you include a complete source-code file, it is not necessary to include the .BI file, because an $INCLUDE metacommand is already in the source-code file. However, if you include the source-code file in your program, you must ensure that you also include any other files (either .BAS or .BI) that the included code might depend on. For example, if you use WINDOW.BAS, you must also include all of the other parts of the User Interface toolbox. The procedures in WINDOW.BAS depend on definitions, declarations, and procedures in each of the other parts. Detailed Description The following sections contain a detailed descriptions of each of the individual parts of the User Interface toolbox. Because the User Interface toolbox is character based, many procedures require row and column coordinates as arguments. Where these are required, the following definitions apply. row%, col% An integer pair that describes a screen position. row1%, col1% An integer pair that describes the upper-left corner of an area. row2%, col 2% An integer pair that describes the lower-right corner of an area. Note ---- The row% and col% coordinates can be actual screen coordinates. However, often they are coordinates that are relative to the upper-left corner of the current window.